Example notebook for the Git Information file

DW 2015.10.2015

This is an example Notebook to show how gitInformation works. Import the gitInformation file to you notebook, make sure that you have installed gitpython (#pip install gitpython) and that the notebook file is located in a local git repository.


In [1]:
import gitInformation

If your notebook is located in a git repository, you are now able to plot some informations about the notebook to verify the version. It's not necessary to set the path, the package will find it by its own.


In [2]:
gitInformation.printInformation()


Information about this notebook
============================================================
Date: 2015-11-24
Python Version: 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, Nov  7 2015, 13:18:40) [MSC v.1500 64 bit (AMD64)]
Git directory: C:\Users\Dominik\Documents\GitRep\ipython-notebook-git\.git
Current git SHA: 3ca88ca17bf89f266a798c0ed08cd8d4430cb107
Remotes: origin, 
Current branch: master
origin remote URL: https://github.com/dowa4213/ipython-notebook-git.git

You're also able to set the path by your own to get the git information.


In [3]:
gitInformation.printInformation('C:\Users\Dominik\Documents\GitRep\ipython-notebook-git\example notebook')


Information about C:\Users\Dominik\Documents\GitRep\ipython-notebook-git\example notebook
============================================================
Date: 2015-11-10
Python Version: 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 16:44:52) [MSC v.1500 64 bit (AMD64)]
Git directory: C:\Users\Dominik\Documents\GitRep\ipython-notebook-git\.git
Current git SHA: 0010ff4a5fc80fe5e297bc67220d667503f084d1
Remotes: origin, 
Current branch: master
origin remote URL: https://github.com/dowa4213/ipython-notebook-git.git

It is also possible to print single information like the current branch, Git commit sha, remote and directory


In [4]:
gitInformation.printCurrentBranch()


Current branch: master

In [5]:
gitInformation.printCurrentGitSHA()


Current git SHA: 0010ff4a5fc80fe5e297bc67220d667503f084d1

In [6]:
gitInformation.printCurrentRemote()


Current remote: origin

In [7]:
gitInformation.printGitDirectory()


Git directory: C:\Users\Dominik\Documents\GitRep\ipython-notebook-git\.git